<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<button id="b" onclick="append()">添加文本框</button>
<button id="b2" onclick="del() ">删除</button>
</body>
</html>
<script>
    function append(){
        //创建文本框
        let wb=document.createElement("input")
        wb.value="A"
        wb.setAttribute("class","a")
        //追加
        document.body.appendChild(wb)

    }
    function del(){
        let hps=document.getElementsByClassName("a")
        //最后一个元素
        let zh=hps[hps.length-1]
        //删除
        document.body.removeChild(zh)

    }

</script>